<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>后台管理系统</title>
    <meta name="author" content="BaiYY"/>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="renderer" content="webkit">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/bootstrap.min.css"/>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/Font/css/font-awesome.min.css"/>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/index.css"/>
    <script type="text/javascript" src="__PUBLIC__/admin/js/jquery.js"></script>
    <script type="text/javascript" src="__PUBLIC__/admin/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/admin/js/index.js"></script>
    <script type="text/javascript" src="__PUBLIC__/admin/js/bootstrap-paginator.js"></script>
</head>
<body>
<div class="right-sidebar" id="myStat" style="max-width: 1200px;">
    <ul class="nav nav-tabs" style="margin-bottom: 16px" role="tablist">
        <li role="presentation"><a href="myStat.html">总业绩</a></li>
        <li role="presentation" class="active"><a href="monthStat.html">每月详情</a></li>
    </ul>
    <section id="numMonth" class="table-responsive">
        <table class="table table-bordered">
           <thead>
               <tr>
                   <th>时间</th>
                   <th>月充值详情</th>
                   <th>月消费详情</th>
               </tr>
           </thead>
            <tbody id="dataList"></tbody>
        </table>
    </section>
</div>
<script type="text/javascript">
    $(function () {
        $.ajax({
            type:"post",
            url:"{:U('Admin/Main/monthStatData')}",
            success:function (data) {
                console.log(data);
                if(data == 'error') {
                    $("#dataList").html("暂时没有任何数据");
                }else{
                    var str = '';
                    var datas = Object.keys(data);
                    var buyData = '';
                    var payData = '';
                    for(var i=0;i<datas.length;++i) {
                        if(data[datas[i]].total_pay == null) {
                            payData = 0;
                        }else{
                            payData = data[datas[i]].total_pay;
                        }
                        if(data[datas[i]].total_buy == null) {
                            buyData = 0;
                        }else{
                            buyData = data[datas[i]].total_buy;
                        }
                        str += "<tr><td>"+datas[i]+"</td><td>"+payData+"</td><td>"+buyData+"</td></tr>"
                    }
                    $("#dataList").html(str);
                }
            }
        });
    })
</script>
</body>
</html>